﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Threading;
using DevExpress.Web.ASPxCallback;
using System.ComponentModel;
using System.Data;
using System.IO;

namespace WebApplication1
{
    public partial class _Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

            if (!IsPostBack)
            {

                DirectoryInfo myImageDir = new DirectoryInfo(MapPath("~/imagenes/HomeInferior/"));

                DirectoryInfo myImageDirHome = new DirectoryInfo(MapPath("~/imagenes/Home/"));
                foreach (FileInfo item in myImageDir.GetFiles())
                {

                }



                try
                {
                    galleryDataList.DataSource = myImageDir.GetFiles();
                    galleryDataList.DataBind();

                    DataListImagesHome.DataSource = myImageDirHome.GetFiles();
                    DataListImagesHome.DataBind();
                }
                catch (System.IO.DirectoryNotFoundException)
                {
                    Response.Write("<script language =Javascript> alert('Error!');</script>");
                }
            }
        }

        protected void ASPxCallback1_Callback(object sender, CallbackEventArgs e)
        {
            int newsID = int.Parse(e.Parameter);


            DataSourceSelectArguments argumentos = new DataSourceSelectArguments();
            DataView dv = (DataView)SqlDataSourceDescripcion.Select(DataSourceSelectArguments.Empty);
            DataTable dt = dv.ToTable();
            foreach (DataRow row in dt.Rows)
            {
                if (row["ENT_ID"].ToString() == newsID.ToString())
                    e.Result = row["ENT_RESENA"].ToString();
            }
        }

    }
}
